package com.shangcheng;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
public class CodeGenerate {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://127.0.0.1:3306/shangcheng?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8", "root", "leng")
                .globalConfig(builder -> builder
                        .author("leng")
                        .outputDir("D:\\javaproject\\shangcheng\\src\\main\\java")//生成的代码存放的目录
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.shangcheng")//父包（目录）
                        .entity("entity")//实体类所在的包名
                        .mapper("mapper")//mapper类所在的包名
                        .service("service")//业务接口类所在的包
                        .serviceImpl("service.impl")//业务实现类所在的包
                        .xml("mappers")//xml映射文件所在的包
                )
                .strategyConfig(builder -> builder
                        .entityBuilder()
                        .enableLombok()  // 实体类启用lombok
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
